<!DOCTYPE html>
<html lang="en" itemscope itemtype="https://schema.org/WebPage">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Vitess / Vitess Sequences</title>

        <!-- Webfont -->
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    
    <!--<link rel="shortcut icon" type="image/png" href="/favicon.png">-->

    <!-- Bootstrap -->
    <link href="/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Styles -->
    <link rel="stylesheet" type="text/css" href="/css/site.css" />
    <!-- Font Awesome icons -->
    <link href="/libs/font-awesome-4.4.0/css/font-awesome.min.css"
          rel="stylesheet"
          type="text/css">
    
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/libs/bootstrap/js/bootstrap.min.js"></script>


    <!-- metadata -->
    <meta name="og:title" content="Vitess / Vitess Sequences"/>
    <meta name="og:image" content="/images/vitess_logo_with_border.svg"/>
    <meta name="og:description" content="Vitess is a database clustering system for horizontal scaling of MySQL."/>

    <link rel="icon" href="/images/vitess_logo_icon_size.png" type="image/png">

    
    <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-60219601-1', 'auto');
  ga('send', 'pageview');
</script>

    
  </head>
  <body class="docs" id="top_of_page">

    <span id="toc-depth" data-toc-depth="h2,h3"></span>


    <nav id="common-nav" class="navbar navbar-fixed-top inverse">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/">
        <img class="logo" src="/images/vitess_logo_with_border.svg" alt="Vitess">
      </a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right" id="standard-menu-links">
        <li><a href="/overview/">Overview</a></li>
        <li><a href="/user-guide/introduction.html">Guides</a></li>
        <li><a href="/reference/vitess-api.html">Reference</a></li>
        <li><a href="http://blog.vitess.io">Blog</a></li>
        <li><a href="https://github.com/youtube/vitess"><i class="fa fa-github"></i> GitHub</a></li>
        <!-- Hide link to blog unless we have actual posts -->
        <!-- <li><a href="/blog/" title="">Blog</a></li> -->
      </ul>
      <ul class="nav nav-stacked mobile-left-nav-menu" id="collapsed-left-menu">
                <li class="submenu">
          <h4 class="arrow-r no-top-margin">Overview</h4>
          <ul style="display: none">
            <li><a href="/overview/">What is Vitess</a></li>
            <li><a href="/overview/scaling-mysql.html">Scaling MySQL with Vitess</a></li>
            <li><a href="/overview/concepts.html">Key Concepts</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Getting Started</h4>
          <ul style="display: none">
            <li style="padding-bottom: 0"><a href="/getting-started/">Run Vitess on Kubernetes</a>
              <ul style="display: block">
                <li style="padding-bottom: 0"><a href="/getting-started/docker-build.html">Custom Docker Build</a></li>
              </ul>
            </li>
            <li><a href="/getting-started/local-instance.html">Run Vitess Locally</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">User Guide</h4>
          <ul style="display: none">
            <li><a href="/user-guide/introduction.html">Introduction</a>
            <li><a href="/user-guide/client-libraries.html">Client Libraries</a>
            <li><a href="/user-guide/backup-and-restore.html">Backing Up Data</a>
            <li><a href="/user-guide/reparenting.html">Reparenting</a></li>
            <li style="padding-bottom: 0"><a href="/user-guide/schema-management.html">Schema Management</a></li>
              <ul style="display: block">
                <li style="padding-bottom: 0"><a href="/user-guide/vschema.html">VSchema Guide</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/schema-swap.html">Schema Swap (Tutorial)</a></li>
              </ul>
            <li style="padding-bottom: 0"><a href="/user-guide/sharding.html">Sharding</a>
              <ul style="display: block">
                <li><a href="/user-guide/horizontal-sharding-workflow.html">Horizontal Sharding (Tutorial, automated)</a></li>
                <li><a href="/user-guide/horizontal-sharding.html">Horizontal Sharding (Tutorial, manual)</a></li>
                <li><a href="/user-guide/sharding-kubernetes-workflow.html">Sharding in Kubernetes (Tutorial, automated)</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/sharding-kubernetes.html">Sharding in Kubernetes (Tutorial, manual)</a></li>
              </ul>
            </li>
            <li><a href="/user-guide/vitess-sequences.html">Vitess Sequences</a></li>
            <li><a href="/user-guide/mysql-server-protocol.html">MySQL Server Protocol</a></li>
            <li><a href="/user-guide/vitess-replication.html">Vitess and Replication</a></li>
            <li><a href="/user-guide/update-stream.html">Update Stream</a></li>
            <li><a href="/user-guide/row-based-replication.html">Row Based Replication</a></li>
            <li><a href="/user-guide/topology-service.html">Topology Service</a></li>
            <li><a href="/user-guide/transport-security-model.html">Transport Security Model</a></li>
            <li style="padding-bottom: 0"><a href="/user-guide/launching.html">Launching</a>
              <ul style="display: block">
                <li><a href="/user-guide/scalability-philosophy.html">Scalability Philosophy</a></li>
                <li><a href="/user-guide/production-planning.html">Production Planning</a></li>
                <li><a href="/user-guide/server-configuration.html">Server Configuration</a></li>
                <li><a href="/user-guide/twopc.html">2PC Guide</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/troubleshooting.html">Troubleshooting</a></li>
              </ul>
            </li>
            <li><a href="/user-guide/upgrading.html">Upgrading</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Reference Guides</h4>
          <ul style="display: none">
            <li><a href="/reference/vitess-api.html">Vitess API</a>
            <li><a href="/reference/vtctl.html">vtctl Commands</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Other Resources</h4>
          <ul style="display: none">
            <li><a href="/resources/presentations.html">Presentations</a>
            <li><a href="http://blog.vitess.io/">Blog</a>
            <li><a href="/resources/roadmap.html">Roadmap</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Contributing</h4>
          <ul style="display: none">
            <li><a href="/contributing/">Contributing to Vitess</a>
            <li><a href="/contributing/github-workflow.html">GitHub Workflow</a>
            <li><a href="/contributing/code-reviews.html">Code Reviews</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Internal</h4>
          <ul style="display: none">
            <li><a href="/internal/">Overview</a>
            <li><a href="/internal/release-instructions.html">Release Instructions</a>
            <li><a href="/internal/publish-website.html">Publish Website</a>
          </ul>
        </li>

        <div>
          <form method="get" action="/search/">
            <input id="search-form" name="q" type="text" placeholder="Search">
          </form>
        </div>

        <li><a href="https://github.com/youtube/vitess" id="collapsed-left-menu-repo-link"><i class="fa fa-github"></i> GitHub</a></li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

    
<div id="masthead">
  <div class="container">
    <div class="row">
      <div class="col-md-9">
        <h1>Vitess Sequences</h1>
      </div>
    </div>
  </div>
</div>


<div class="container">
    <div class="row scroll-margin" id="toc-content-row">
    <div class="col-md-2" id="leftCol">
      <ul class="nav nav-stacked mobile-left-nav-menu" id="sidebar">
                <li class="submenu">
          <h4 class="arrow-r no-top-margin">Overview</h4>
          <ul style="display: none">
            <li><a href="/overview/">What is Vitess</a></li>
            <li><a href="/overview/scaling-mysql.html">Scaling MySQL with Vitess</a></li>
            <li><a href="/overview/concepts.html">Key Concepts</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Getting Started</h4>
          <ul style="display: none">
            <li style="padding-bottom: 0"><a href="/getting-started/">Run Vitess on Kubernetes</a>
              <ul style="display: block">
                <li style="padding-bottom: 0"><a href="/getting-started/docker-build.html">Custom Docker Build</a></li>
              </ul>
            </li>
            <li><a href="/getting-started/local-instance.html">Run Vitess Locally</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">User Guide</h4>
          <ul style="display: none">
            <li><a href="/user-guide/introduction.html">Introduction</a>
            <li><a href="/user-guide/client-libraries.html">Client Libraries</a>
            <li><a href="/user-guide/backup-and-restore.html">Backing Up Data</a>
            <li><a href="/user-guide/reparenting.html">Reparenting</a></li>
            <li style="padding-bottom: 0"><a href="/user-guide/schema-management.html">Schema Management</a></li>
              <ul style="display: block">
                <li style="padding-bottom: 0"><a href="/user-guide/vschema.html">VSchema Guide</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/schema-swap.html">Schema Swap (Tutorial)</a></li>
              </ul>
            <li style="padding-bottom: 0"><a href="/user-guide/sharding.html">Sharding</a>
              <ul style="display: block">
                <li><a href="/user-guide/horizontal-sharding-workflow.html">Horizontal Sharding (Tutorial, automated)</a></li>
                <li><a href="/user-guide/horizontal-sharding.html">Horizontal Sharding (Tutorial, manual)</a></li>
                <li><a href="/user-guide/sharding-kubernetes-workflow.html">Sharding in Kubernetes (Tutorial, automated)</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/sharding-kubernetes.html">Sharding in Kubernetes (Tutorial, manual)</a></li>
              </ul>
            </li>
            <li><a href="/user-guide/vitess-sequences.html">Vitess Sequences</a></li>
            <li><a href="/user-guide/mysql-server-protocol.html">MySQL Server Protocol</a></li>
            <li><a href="/user-guide/vitess-replication.html">Vitess and Replication</a></li>
            <li><a href="/user-guide/update-stream.html">Update Stream</a></li>
            <li><a href="/user-guide/row-based-replication.html">Row Based Replication</a></li>
            <li><a href="/user-guide/topology-service.html">Topology Service</a></li>
            <li><a href="/user-guide/transport-security-model.html">Transport Security Model</a></li>
            <li style="padding-bottom: 0"><a href="/user-guide/launching.html">Launching</a>
              <ul style="display: block">
                <li><a href="/user-guide/scalability-philosophy.html">Scalability Philosophy</a></li>
                <li><a href="/user-guide/production-planning.html">Production Planning</a></li>
                <li><a href="/user-guide/server-configuration.html">Server Configuration</a></li>
                <li><a href="/user-guide/twopc.html">2PC Guide</a></li>
                <li style="padding-bottom: 0"><a href="/user-guide/troubleshooting.html">Troubleshooting</a></li>
              </ul>
            </li>
            <li><a href="/user-guide/upgrading.html">Upgrading</a></li>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Reference Guides</h4>
          <ul style="display: none">
            <li><a href="/reference/vitess-api.html">Vitess API</a>
            <li><a href="/reference/vtctl.html">vtctl Commands</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Other Resources</h4>
          <ul style="display: none">
            <li><a href="/resources/presentations.html">Presentations</a>
            <li><a href="http://blog.vitess.io/">Blog</a>
            <li><a href="/resources/roadmap.html">Roadmap</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Contributing</h4>
          <ul style="display: none">
            <li><a href="/contributing/">Contributing to Vitess</a>
            <li><a href="/contributing/github-workflow.html">GitHub Workflow</a>
            <li><a href="/contributing/code-reviews.html">Code Reviews</a>
          </ul>
        </li>
        <li class="submenu">
          <h4 class="arrow-r">Internal</h4>
          <ul style="display: none">
            <li><a href="/internal/">Overview</a>
            <li><a href="/internal/release-instructions.html">Release Instructions</a>
            <li><a href="/internal/publish-website.html">Publish Website</a>
          </ul>
        </li>

        <div>
          <form method="get" action="/search/">
            <input id="search-form" name="q" type="text" placeholder="Search">
          </form>
        </div>

      </ul>
    </div>
    <div class="col-md-3" id="rightCol">
      <div class="nav nav-stacked" id="tocSidebar">
        <div id="toc"></div>
      </div>
    </div>
    <div class="col-md-7" id="centerCol">
      <div id="centerTextCol">
        <h1 id="vitess-sequences">Vitess Sequences</h1>

<p>This document describes the Vitess Sequences feature, and how to use it.</p>

<h2 id="motivation">Motivation</h2>

<p>MySQL provides the <code class="prettyprint">auto-increment</code> feature to assign monotonically incrementing
IDs to a column in a table. However, when a table is sharded across multiple
instances, maintaining the same feature is a lot more tricky.</p>

<p>Vitess Sequences fill that gap:</p>

<ul>
<li><p>Inspired from the usual SQL sequences (implemented in different ways by
Oracle, SQL Server and PostgreSQL).</p></li>
<li><p>Very high throughput for ID creation, using a configurable in-memory block allocation.</p></li>
<li><p>Transparent use, similar to MySQL auto-increment: when the field is omitted in
an <code class="prettyprint">insert</code> statement, the next sequence value is used.</p></li>
</ul>

<h2 id="when-not-to-use-auto-increment">When <em>not</em> to Use Auto-Increment</h2>

<p>Before we go any further, an auto-increment column has limitations and
drawbacks. let&#39;s explore this topic a bit here.</p>

<h3 id="security-considerations">Security Considerations</h3>

<p>Using auto-increment can leak confidential information about a service. Let&#39;s
take the example of a web site that store user information, and assign user IDs
to its users as they sign in. The user ID is then passed in a cookie for all
subsequent requests.</p>

<p>The client then knows their own user ID. It is now possible to:</p>

<ul>
<li><p>Try other user IDs and expose potential system vulnerabilities.</p></li>
<li><p>Get an approximate number of users of the system (using the user ID).</p></li>
<li><p>Get an approximate number of sign-ins during a week (creating two accounts a
week apart, and diffing the two IDs).</p></li>
</ul>

<p>Auto-incrementing IDs should be reserved for either internal applications, or
exposed to the clients only when safe.</p>

<h3 id="alternatives">Alternatives</h3>

<p>Alternative to auto-incrementing IDs are:</p>

<ul>
<li><p>use a 64 bits random generator number. Try to insert a new row with that
ID. If taken (because the statement returns an integrity error), try another
ID.</p></li>
<li><p>use a UUID scheme, and generate trully unique IDs.</p></li>
</ul>

<p>Now that this is out of the way, let&#39;s get to MySQL auto-increment.</p>

<h2 id="mysql-auto-increment-feature">MySQL Auto-increment Feature</h2>

<p>Let&#39;s start by looking at the MySQL auto-increment feature:</p>

<ul>
<li><p>A row that has no value for the auto-increment value will be given the next ID.</p></li>
<li><p>The current value is stored in the table metadata.</p></li>
<li><p>Values may be ‘burned’ (by rolled back transactions).</p></li>
<li><p>Inserting a row with a given value that is higher than the current value will
set the current value.</p></li>
<li><p>The value used by the master in a statement is sent in the replication stream,
so slaves will have the same value when re-playing the stream.</p></li>
<li><p>There is no strict guarantee about ordering: two concurrent statements may
have their commit time in one order, but their auto-incrementing ID in the
opposite order (as the value for the ID is reserved when the statement is
issued, not when the transaction is committed).</p></li>
<li><p>MySQL has multiple options for auto-increment, like only using every N number
(for multi-master configurations), or performance related features (locking
that table’s current ID may have concurrency implications).</p></li>
<li><p>When inserting a row in a table with an auto-increment column, if the value
for the auto-increment row is not set, the value for the column is returned to
the client alongside the statement result.</p></li>
</ul>

<h2 id="vitess-sequences">Vitess Sequences</h2>

<p>An early design was to use a single unsharded database and a table with an
auto-increment value to generate new values. However, this has serious
limitations, in particular throughtput, and storing one entry for each value in
that table, for no reason.</p>

<p>So we decided instead to base sequences on a MySQL table, and use a single value
in that table to describe which values the sequence should have next. To
increase performance, we also support block allocation of IDs: each update to
the MySQL table is only done every N IDs (N being configurable), and in between
only memory structures in vttablet are updated, making the QPS only limited by
RPC latency.</p>

<p>In a sharded keyspace, a Sequence&#39;s data is only present in one shard (but its
schema is in all the shards). We configure which shard has the data by using a
keyspace_id for the sequence, and route all sequence traffic to the shard that
hold that keyspace_id. That way we are completely compatible with any horizontal
resharding.</p>

<p>The final goal is to have Sequences supported with SQL statements, like:</p>
<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="cm">/* DDL support */</span>
<span class="k">CREATE</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="k">SELECT</span> <span class="k">NEXT</span> <span class="n">VALUE</span> <span class="k">FROM</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="k">ALTER</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span> <span class="p">...;</span>

<span class="k">DROP</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="k">SHOW</span> <span class="k">CREATE</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>
</code></pre></div>
<p>In the current implementation, we support the query access to Sequences, but not
the administration commands yet.</p>

<h3 id="creating-a-sequence">Creating a Sequence</h3>

<p><em>Note</em>: The names in this section are extracted from the examples/demo sample
application.</p>

<p>To create a Sequence, a backing table must first be created. The columns for
that table have to be respected.</p>

<p>This is an example:</p>
<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="k">create</span> <span class="k">table</span> <span class="n">user_seq</span><span class="p">(</span><span class="n">id</span> <span class="nb">int</span><span class="p">,</span> <span class="n">next_id</span> <span class="nb">bigint</span><span class="p">,</span> <span class="k">cache</span> <span class="nb">bigint</span><span class="p">,</span> <span class="k">primary</span> <span class="k">key</span><span class="p">(</span><span class="n">id</span><span class="p">))</span> <span class="k">comment</span> <span class="s1">&#39;vitess_sequence&#39;</span><span class="p">;</span>
</code></pre></div>
<p>Then, the Sequence has to be define in the VSchema for that keyspace:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span class="p">{</span>
  <span class="nt">&quot;sharded&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  <span class="nt">&quot;tables&quot;</span><span class="p">:</span> <span class="p">{</span>
    <span class="nt">&quot;user_seq&quot;</span><span class="p">:</span> <span class="p">{</span>
      <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;sequence&quot;</span>
    <span class="p">},</span>
    <span class="err">...</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>And the table it is going to be using it can also reference the Sequence in its VSchema:</p>
<div class="highlight"><pre><code class="language-json" data-lang="json"><span class="p">{</span>
  <span class="err">...</span>
  <span class="nt">&quot;tables&quot;</span> <span class="p">:</span> <span class="p">{</span>
    <span class="nt">&quot;user&quot;</span><span class="p">:</span> <span class="p">{</span>
      <span class="nt">&quot;column_vindexes&quot;</span><span class="p">:</span> <span class="p">[</span>
           <span class="err">...</span>
      <span class="p">],</span>
      <span class="nt">&quot;auto_increment&quot;</span><span class="p">:</span> <span class="p">{</span>
        <span class="nt">&quot;column&quot;</span><span class="p">:</span> <span class="s2">&quot;user_id&quot;</span><span class="p">,</span>
        <span class="nt">&quot;sequence&quot;</span><span class="p">:</span> <span class="s2">&quot;user_seq&quot;</span>
      <span class="p">}</span>
    <span class="p">},</span>
</code></pre></div>
<p>After this done (and the Schema has been reloaded on master tablet, and the
VSchema has been pushed), the sequence can be used.</p>

<h3 id="accessing-a-sequence">Accessing a Sequence</h3>

<p>If a Sequence is used to fill in a column for a table, nothing further needs to
be done. Just sending no value for the column will make vtgate insert the next
Sequence value in its place.</p>

<p>It is also possible to access the Sequence directly with the following SQL constructs:</p>
<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="cm">/* Returns the next value for the sequence */</span>
<span class="k">select</span> <span class="k">next</span> <span class="n">value</span> <span class="k">from</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="cm">/* Returns the next value for the sequence, and also reserve 4 values after that. */</span>
<span class="k">select</span> <span class="k">next</span> <span class="mi">5</span> <span class="k">values</span> <span class="k">from</span> <span class="n">my_sequence</span><span class="p">;</span>
</code></pre></div>
<h2 id="to-do-list">TO-DO List</h2>

<h3 id="ddl-support">DDL Support</h3>

<p>We want to add DDL support for sequences, as previously mentioned:</p>
<div class="highlight"><pre><code class="language-sql" data-lang="sql"><span class="k">CREATE</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="k">ALTER</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span> <span class="p">...;</span>

<span class="k">DROP</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>

<span class="k">SHOW</span> <span class="k">CREATE</span> <span class="n">SEQUENCE</span> <span class="n">my_sequence</span><span class="p">;</span>
</code></pre></div>
<p>But for now, the Sequence backing table has to be created and managed using the
usual schema management features, with the right column definitions and table comment.</p>

      </div>
    </div>
  </div>

</div>

    <div class="page-spacer"></div>
    <footer role="contentinfo" id="site-footer">
  <nav role="navigation" class="menu bottom-menu">
    
    <a href="https://groups.google.com/forum/#!forum/vitess" target="_blank">Contact: vitess@googlegroups.com</a>&nbsp;&nbsp;<b>·</b>&nbsp;&nbsp;
    <a href="https://groups.google.com/forum/#!forum/vitess-announce" target="_blank">Announcements</a>&nbsp;&nbsp;<b>·</b>&nbsp;&nbsp;
    &#169; 2017 <a href="/">Vitess</a> powered by <a href="https://developers.google.com/open-source/">Google Inc</a>
  </nav>
</footer>


        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>   -->
    <!-- Include all compiled plugins (below), or include individual files as needed -->
<!--
    <script src="/libs/bootstrap/js/bootstrap.min.js"></script>
-->
    <!-- Include the common site javascript -->
    <script src="/js/common.js" type="text/javascript" charset="utf-8"></script>


  </body>
</html>
